prj_show_deps_chain:
	$(show) ""                                                           ; \
	ident=`cat $(HOME)/.d`                                               ; \
	ident=`echo $$ident+1 | bc`                                          ; \
	cont_ident=0                                                         ; \
	while [ $$cont_ident -lt $$ident ]; do                                 \
		echo -n "\t "                                                ; \
		cont_ident=`echo $$cont_ident+1 | bc`                        ; \
	done                                                                 ; \
	echo -n "$(project) - $(product_type)"                               ; \
	rm -f $(HOME)/.d                                                     ; \
	echo $$ident > $(HOME)/.d                                            ; \
	for dep in `echo $(prj_depends)`; do                                   \
		make project=$$dep prj_show_deps_chain                       ; \
	done                                                                 ; \
	ident=`echo $$ident-1 | bc`                                          ; \
	rm -f $(HOME)/.d                                                     ; \
	echo $$ident > $(HOME)/.d                                            ; 





#@public@|prj_list|Lists all the avaiable projects
#@public_detailed@|prj_list|Syntax 'make prj_list'
prj_list:
	$(show) ""                                                           ; \
	echo "------------------------------------------------------------"  ; \
	echo "Avaiable Projects"                                             ; \
	echo "------------------------------------------------------------"  ; \
	echo ""                                                              ; \
	ls $(dir_prjs)                                                       ; \
	echo ""                                                              ; 


#@public@|prj_info|Display information about a project
#@public_detailed@|prj_info|Syntax 'make project=<project-name> [verbose=0/1]  [target=debug/release] prj_info
#@public_detailed@|prj_info|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
prj_info: setup
	$(show) ""                                                           ; \
	echo "**************************************** "                     ; \
	echo "Definitions for '$(project)'"                                  ; \
	echo "  Type of product                     'product_type=$(product_type)'"  ; \
	echo "  Target                              'target=$(target)'"      ; \
	echo "  Internal dependencies"                                       ; \
	tag="prj_int_static_libs:="                                          ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                        ; \
	echo "    Static libraries                  '$$value'"               ; \
	tag="prj_int_shared_libs:="                                          ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Shared libraries                  '$$value'"               ; \
	tag="prj_int_just_copy:="                                            ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Projects just-copied              '$$value'"               ; \
	tag="prj_int_pgms:="                                                 ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Programs                          '$$value'"               ; \
	echo "    Internal Dependancies =           '$(depends)'"            ; \
	echo "    Compile Flags =                   '$(compile_flags)'"      ; \
	echo "    Major Version Number =            '$(M_version)'"          ; \
	echo "    Minor version Number =            '$(m_version)'"          ; \
	echo "    Build Number =                    '$(build_number)'"       ; \
	echo "    Verbose =                         '$(build_number)'"       ; \
	echo ""                                                              ; \
	echo "  External dependencies"                                       ; \
	tag="prj_ext_lib_dir:="                                              ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Libraries dir                     '$$value'"               ; \
	tag="prj_ext_static_libs:="                                          ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Static libraries                  '$$value'"               ; \
	tag="prj_ext_inc_dir:="                                              ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Includes dir                      '$$value'"               ; \
	tag="prj_ext_shared_libs:="                                          ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Shared libraries                  '$$value'"               ; \
	tag="prj_ext_pgms:="                                                 ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Programs                          '$$value'"               ; \
	echo ""                                                              ; \
	tag="prj_minus_d:="                                                  ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "Options used for compiling            '$$value'"               ; \
	echo ""                                                              ; \
	echo "Definitions for the Test of '$(project)'"                      ; \
	echo "  Test type                           '$(test_type)'"          ; \
	echo "  Test depends                        '$(test_depends)'"       ; \
	echo "  Internal dependencies"                                       ; \
	tag="test_int_static_libs:="                                         ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Static libraries                  '$$value'"               ; \
	tag="test_int_shared_libs:="                                         ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Shared libraries                  '$$value'"               ; \
	tag="test_int_just_copy:="                                           ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Projects just-copied              '$$value'"               ; \
	tag="test_int_pgms:="                                                ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Programs                          '$$value'"               ; \
	echo "  External dependencies"                                       ; \
	tag="test_ext_lib_dir:="                                             ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Libraries dir                     '$$value'"               ; \
	tag="test_ext_inc_dir:="                                             ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Includes dir                      '$$value'"               ; \
	tag="test_ext_static_libs:="                                         ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Static libraries                  '$$value'"               ; \
	tag="test_ext_shared_libs:="                                         ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Shared libraries                  '$$value'"               ; \
	tag="test_ext_pgms:="                                                ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "    Programs                          '$$value'"               ; \
	echo ""                                                              ; \
	tag="test_minus_d:="                                                 ; \
	value=`grep "$$tag" "$(dir_prj)/project.mk"`                    ; \
	echo "Options used for compiling the test   '$$value'"               ; \
	echo ""                                                              ; \
	echo "Calculated variables for '$(project)'"                         ; \
	echo "  Options for compiling               'final_prj_minus_d=$(final_prj_minus_d)'" ; \
	echo "  Includes dir used                   'final_prj_inc_dir=$(final_prj_inc_dir)'" ; \
	echo "  Libraries dir used                  'final_prj_lib_dir=$(final_prj_lib_dir)'" ; \
	echo "  Shared libs                         'final_prj_shared_libs=$(final_prj_shared_libs)'" ; \
	echo "  Static libs                         'final_prj_static_libs=$(final_prj_static_libs)'" ; \
	echo "  Modules                             'final_prj_modules=$(final_prj_modules)'" ; \
	echo "  Programs                            'final_prj_pgms=$(final_prj_pgms)'" ; \
	echo "  Just-copy Project                   'final_prj_just_copy=$(final_prj_just_copy)'" ; \
	echo "  Qt files                            'qt_code=$(qt_code)'"    ; \
	echo "qt_code_cpps=$(qt_code_cpps)"                                  ; \
	echo "qt_code_hs=$(qt_code_hs)"                                      ; \
	echo "  C++ source files                    'prj_srcs=$(code_srcs)'" ; \
	echo "  C++ object files                    'prj_objs=$(code_objs)'" ; \
	echo ""                                                              ; \
	echo "Calculated variables for the Test of '$(project)'"             ; \
	echo "  Options for compiling               'final_test_minus_d=$(final_test_minus_d)'" ; \
	echo "  Includes dir used                   'final_test_inc_dir=$(final_test_inc_dir)'" ; \
	echo "  Libraries dir used                  'final_test_lib_dir=$(final_test_lib_dir)'" ; \
	echo "  Shared libs                         'final_test_shared_libs=$(final_test_shared_libs)'" ; \
	echo "  Static libs                         'final_test_static_libs=$(final_test_static_libs)'" ; \
	echo "  Programs                            'final_test_pgms=$(final_test_pgms)'" ; \
	echo "  Qt test files                       'qt_test=$(qt_test)'"    ; \
	echo "  C++ source files                    'test_srcs=$(test_srcs)'"; \
	echo "  C++ object files                    'test_objs=$(test_objs)'"; \
	echo "  Search lib dir                      'search_lib_dir=$(search_lib_dir)'"; \
	echo ""                                                              ; 


#@public@|prj_info_chain|Shows information for all the projects that project depend on, and the project itself.
#@public_detailed@|prj_info_chain|Syntax 'make project=<project-name> [verbose=0/1]  [target=debug/release] prj_info_chain
#@public_detailed@|prj_info_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
prj_info_chain:
	$(show) ""                                                           ; \
	echo "********************************************* "                ; \
	$(make_cmd) chain chain_target=info_project                          ; \
	$(make_cmd) info_project                                             ;


#@public@|prj_new|Creates the directories and files for a new component. 
#@public_detailed@|prj_new|Syntax: make project=<project-name> [verbose=0/1] prj_new
#@public_detailed@|prj_new|
#@public_detailed@|prj_new|Where <project-name> is the name of the project, which will also be the name of the directory of the project.
#@public_detailed@|prj_new| 
#@public_detailed@|prj_new|If 'verbose' is not defined, it is assumed '0'. 
#@public_detailed@|prj_new| 
#@public_detailed@|prj_new|A file 'project.mk' will be created in 'tenacitas/cpp/prj/gmake/<project-name>'. You should edit this file, in order to configure the project.
prj_new:
	@echo ""                                                             ; \
	echo "************************************************************"  ; \
	echo "Creating directories for new project '$(project)'"             ; \
	if [ -z "$(project)" ]; then                                           \
		echo ""                                                      ; \
		echo ""                                                      ; \
		echo "ERROR:"                                                ; \
		echo "    Please, type 'make cmd_info cmd=prj_new' for detailed information on how to create a project." ; \
	else                                                                   \
		$(make_cmd) setup                                            ; \
	fi                                                                   ;


#@public@|prj_new_h_file|Creates a new header file
#@public_detailed@|prj_new_h_file|Syntax: make new_h_file project=<project-name> [verbose=0/1] file=<file_name>
#@public_detailed@|prj_new_h_file|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_new_h_file|Where <file-name> is the name of the header file to be created
prj_new_h_file: setup
	$(show) ""                                                           ; \
	if [ ! -z "$(file)" ]; then                                            \
		new_h="$(file).$(header_extension)"                          ; \
		echo "**************************************** "             ; \
		echo -n "Creating '$$new_h' for project '$(project)'"        ; \
		new_h_path="$(dir_inc)/$$new_h"                              ; \
		if [ ! -f "$$new_h" ]; then                                    \
			prj=`echo "$(project)" | sed 's/\./_/g'`             ; \
			new_h_def=__"$$prj"__"$(file)"__"$(header_extension)"__  ; \
			echo "#ifndef $$new_h_def" > "$$new_h_path"          ; \
			echo "#define $$new_h_def" >> "$$new_h_path"         ; \
			cat $(dir_tool)/aux_files/header_model.h               \
				>> "$$new_h_path"                            ; \
		fi                                                           ; \
	fi                                                                   ;


#@public@|prj_new_file|Creates a new header-source file pair
#@public_detailed@|prj_new_file|Syntax: make new_file project=<project-name> [verbose=0/1] file=<file_name>
#@public_detailed@|prj_new_file|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_new_file|Where <file-name> is the name of the header and source file to be created
prj_new_file: setup
	$(show) ""                                                           ; \
	if [ ! -z "$(file)" ]; then                                            \
		new_h="$(file).$(header_extension)"                          ; \
		new_cpp="$(file).$(source_extension)"                        ; \
		echo "**************************************** "             ; \
		echo -n "Creating '$$new_h' and '$$new_cpp'"                 ; \
		echo "for project '$(project)'"                              ; \
		new_h_path="$(dir_inc)/$$new_h"                              ; \
		new_cpp_path="$(dir_src)/$$new_cpp"                          ; \
		if [ ! -f "$$new_h" ]; then                                    \
			prj=`echo "$(project)" | sed 's/\./_/g'`             ; \
			new_h_def=__"$$prj"__"$(file)"__"$(header_extension)"__  ; \
			echo "#ifndef $$new_h_def" > "$$new_h_path"          ; \
			echo "#define $$new_h_def" >> "$$new_h_path"         ; \
			cat $(dir_tool)/aux_files/header_model.h               \
				>> "$$new_h_path"                            ; \
			echo "#include <$$new_h>" > "$$new_cpp_path"         ; \
		fi                                                           ; \
	fi                                                                   ;




#@public@|prj_build|Builds the Project.
#@public@|prj_build|This means that all the parts that compound a Project, i.e, Code, Documentation, Configuration, Input and Test, are built.
#@public_detailed@|prj_build|Syntax: make project=<project-dir-name> [coc=<cpu-os-compiler>] [verbose=0/1] [target=debug/release] prj_build.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|If 'coc' is not defined, it is assumed 'x86_linux_g++'. 
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|If 'verbose' is not defined, it is assumed '0'. If 'target' is not defined, it is assumed 'debug'.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|Please, run 'make prj_list' for a list of the avaiable projects, and 'make prj_info project=<prj>' to list the variables defined for a Project.
#@public_detailed@|prj_build|Please, run 'make coc_list' for a list of CPU,OS and compiler avaiable combinations, and 'make coc_info coc=<coc>' to list the variables defined for a CPU, OS and compiler combination.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|About the Code: 
#@public_detailed@|prj_build|If the Project builds a program, i.e. the variable 'product_type' in the 'tenacitas.prj_build_system/cpp/bin/$(project)/tool/gmake/project.mk' file values '$(program)', the executable generated is placed in the directory referenced in the variable 'prj_build_bin_dir', which is defined in the 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk' file. 
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|If the Project builds a libray, i.e. the variable 'product_type' in the 'tenacitas.prj_build_system/cpp/bin/$(project)/tool/gmake/project.mk' file values '$(library)', the static and dymanic libraries generated are placed in the directory referenced in the variable 'prj_build_lib_dir', which is defined in the 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk' file. 
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|If the variable 'product_type' in the 'tenacitas.prj_build_system/cpp/bin/$(project)/tool/gmake/project.mk' file values '$(just_copy_files)', the existing files in the directory 'tenacitas.prj_build_system/cpp/src/$(project)/code' are copied to the directory referenced in the variable 'prj_build_inc_dir', which is defined in the 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk' file.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|About the Documentation: 
#@public_detailed@|prj_build|The documentation generated in 'tenacitas.prj_build_system/cpp/src/$(project)/doc' is copied to 'prj_build_lib_dir', which is defined in 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk'.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|About the Input:
#@public_detailed@|prj_build|The Input defines which files are necessary for the program or library generated by the Project to work, such as images, translations and configuration files.
#@public_detailed@|prj_build|In 'tenacitas.prj_build_system/cpp/src/$(project)/input/' there is a directory named $(project), which will be copied to 'prj_build_input_dir', which is a variable defined in the 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk' file.
#@public_detailed@|prj_build|  
#@public_detailed@|prj_build|About the Test:
#@public_detailed@|prj_build|The files in 'tenacitas.prj_build_system/cpp/src/$(project)/test' will generate a program, or library, that will be placed in 'prj_build_bin_dir' or 'prj_build_lib_dir', which are defined in 'tenacitas.prj_build_system/cpp/tool/gmake/cpu_os_comp/$(coc).mk'.
prj_build: code_build doc_build input_build test_build

#@public@|prj_clean|Cleans the Project 
#@public@|prj_clean|This means that all the parts that compound a Project, i.e, Code, Documentation and Test are cleaned
#@public_detailed@|prj_clean|Syntax 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] prj_clean
#@public_detailed@|prj_clean|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_clean|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
prj_clean : code_clean doc_clean test_clean 

#@public@|prj_rebuild|Rebuilds the Project, i.e., cleans and build the project.
#@public_detailed@|prj_rebuild|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] prj_rebuild
#@public_detailed@|prj_clean|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_clean|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
prj_rebuild : prj_clean prj_build

#@public@|prj_build_chain|Builds all the projects that a project depend on, and the project itself. 
#@public@|prj_build_chain|This means that all the parts that compound a Project, i.e, Code, Documentation, Input and Test are also build in chain
#@public_detailed@|prj_build_chain|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] prj_build_chain
#@public_detailed@|prj_build_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_build_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
prj_build_chain : code_build_chain doc_build_chain input_build_chain test_build_chain

#@public@|prj_clean_chain|Cleans all the projects that a project depend on, and the project itself. 
#@public@|prj_clean_chain|This means that all the parts that compound a Project, i.e, Code, Documentation and Test, are also cleaned in chain
#@public_detailed@|prj_clean_chain|Syntax: 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] prj_clean_chain
#@public_detailed@|prj_clean_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_clean_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
prj_clean_chain : code_clean_chain doc_clean_chain test_clean_chain


#@public@|prj_rebuild_chain|Cleans and build all the projects that a project depend on, and the project itself. 
#@public@|prj_rebuild_chain|This means that all the parts that compound a Project, i.e, Code, Documentation, Configuration, Input and Test, are also rebuild in chain
#@public_detailed@|prj_rebuild_chain|Syntax 'make project=<project-name> [coc=<cpu-os-compiler>] [verbose=0/1]  [target=debug/release] prj_rebuild_chain
#@public_detailed@|prj_rebuild_chain|Where <project-name> is an existing project. Please rum 'make prj_list' to list all the avaiable projects.
#@public_detailed@|prj_rebuild_chain|Where <cpu-os-compiler> is the name of a file that contain definitions for a CPU, OS and compiler. Please, run 'make coc_list' to list all the combinations avaiables.
prj_rebuild_chain : prj_clean_chain prj_build_chain



#@public@|prj_show_deps|Shows the dependencies of a project, and theirs dependencies recursevely
#@public_detailed@|prj_show_deps|Syntax: make project=<project-name> prj_show_deps
prj_show_deps:
	$(show) ""                                                           ; \
	echo "********************************************* "                ; \
	echo "Showing dependencies for $(project)"                           ; \
	rm -f $(HOME)/.d                                                     ; \
	echo "-1" > $(HOME)/.d                                               ; \
	make project=$(project) prj_show_deps_chain                          ; \
	rm -f $(HOME)/.d                                                     ; \
	echo ""                                                              ;


#@public@|prj_del|Deletes a project from the local file system, not from the repository
#@public_detailed@|prj_del|Syntax: make project=<project-name> prj_del
prj_del:
	$(show) ""                                                           ; \
	echo "********************************************* "                ; \
	echo "Deleting $(project)"                                           ; \
	make project=$(project) prj_clean                                    ; \
	rm -rf $(dir_prj) 2> /dev/null                                       ; \
	rm -rf $(dir_src) 2> /dev/null                                       ; \
	rm -rf $(dir_obj) 2> /dev/null                                       ; \
	rm -rf $(dir_inc) 2> /dev/null                                       ; \
	rm -rf $(dir_doc) 2> /dev/null                                       ; \
	rm -rf $(dir_cfg) 2> /dev/null                                       ; \
	rm -rf $(dir_inp) 2> /dev/null                                       ; \
	rm -rf $(dir_out) 2> /dev/null                                       ; \
	rm -rf $(dir_tst) 2> /dev/null                                       ; 


